import {
	baseUrl,
	token
} from "../utils/request.js"
// 上传图片
export function uploadImg(file) {
	return uni.uploadFile({
		url: baseUrl + '/prod-api/common/upload',
		header: {
			'Authorization': 'Bearer ' + token()
		},
		file: file,
		name: 'file'
	})
}
// 新增调查信息
export function addResearchInfo(data) {
	return uni.request({
		url: baseUrl + '/prod-api/system/researchInfo',
		header: {
			'Authorization': 'Bearer ' + token()
		},
		method: "POST",
		data: data
	});
}

// 图片上传
export function imgBase64Upload(data) {
	return uni.request({
		url: baseUrl + '/prod-api/common/upload64',
		header: {
			'Authorization': 'Bearer ' + token()
		},
		method: "POST",
		data: data
	});
}

// 解析地址
export function geoCoder(location) {
	let data = {
		location,
		key:'SB6BZ-VS36F-VG2JV-NOT2B-XO6WZ-Z3FLN'
	}
	return uni.request({
		url: 'https://apis.map.qq.com/ws/geocoder/v1/',
		method: "POST",
		data: data
	});
}

// 查询region
export function listRegion(query) {
    return uni.request({
        url: baseUrl +'/prod-api/system/region/list',
		header: {
			'Authorization': 'Bearer ' + token()
		},
        method: 'get',
        data: query
    })
}

// 查询完整地址
export function fullAddress(regionId) {
    return uni.request({
        url: baseUrl +'/prod-api/portal/region/fullAddress',
        method: 'get',
		header: {
			'Authorization': 'Bearer ' + token()
		},
        data: regionId
    })
}